package com.heima.apis.scheule;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.schedule.dto.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author: xsz
 * @DateTime: 2024/2/27 23:44
 **/

@FeignClient("leadnews-schedule")
public interface IScheduleClient {

    /**
     * 添加延迟任务
     * @param task
     * @return
     */
    @PostMapping("/api/v1/task/add")
    ResponseResult  addTask(@RequestBody  Task task);

    /**
     * 取消延迟任务
     * @param taskId
     * @return
     */
    @GetMapping("/api/v1/task/{taskId}")
    ResponseResult  cancelTask(@PathVariable("taskId") long taskId);


    /**
     * 拉取任务
     * @return
     */
    @GetMapping("/api/v1/task/{type}/{priority}")
    ResponseResult  poll(@PathVariable("type") int type, @PathVariable("priority") int priority);

}
